summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2022-08-20 04:15:23 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2022-10-06 21:00:54 +0200
commit0d99b7962d8e06958668168cdae155fd1e3d1757 (patch)
tree55ef394dafbe74050da9cffbc184a3c898ce71b7
parentgeneral: rework usages of UNREACHABLE macro (diff)
downloadyuzu-0d99b7962d8e06958668168cdae155fd1e3d1757.tar
yuzu-0d99b7962d8e06958668168cdae155fd1e3d1757.tar.gz
yuzu-0d99b7962d8e06958668168cdae155fd1e3d1757.tar.bz2
yuzu-0d99b7962d8e06958668168cdae155fd1e3d1757.tar.lz
yuzu-0d99b7962d8e06958668168cdae155fd1e3d1757.tar.xz
yuzu-0d99b7962d8e06958668168cdae155fd1e3d1757.tar.zst
yuzu-0d99b7962d8e06958668168cdae155fd1e3d1757.zip
-rw-r--r--src/video_core/query_cache.h6
-rw-r--r--src/video_core/renderer_opengl/gl_state_tracker.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_state_tracker.h1
-rw-r--r--src/video_core/renderer_vulkan/vk_state_tracker.cpp3
-rw-r--r--src/video_core/renderer_vulkan/vk_state_tracker.h1
5 files changed, 9 insertions, 4 deletions
diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h
index eb68ea638..b0ebe71b7 100644
--- a/src/video_core/query_cache.h
+++ b/src/video_core/query_cache.h
@@ -135,8 +135,10 @@ public:
/// Updates counters from GPU state. Expected to be called once per draw, clear or dispatch.
void UpdateCounters() {
std::unique_lock lock{mutex};
- const auto& regs = maxwell3d->regs;
- Stream(VideoCore::QueryType::SamplesPassed).Update(regs.samplecnt_enable);
+ if (maxwell3d) {
+ const auto& regs = maxwell3d->regs;
+ Stream(VideoCore::QueryType::SamplesPassed).Update(regs.samplecnt_enable);
+ }
}
/// Resets a counter to zero. It doesn't disable the query after resetting.
diff --git a/src/video_core/renderer_opengl/gl_state_tracker.cpp b/src/video_core/renderer_opengl/gl_state_tracker.cpp
index 3657f867d..a8f3a0f57 100644
--- a/src/video_core/renderer_opengl/gl_state_tracker.cpp
+++ b/src/video_core/renderer_opengl/gl_state_tracker.cpp
@@ -237,6 +237,6 @@ void StateTracker::InvalidateState() {
flags->set();
}
-StateTracker::StateTracker() : flags{} {}
+StateTracker::StateTracker() : flags{&default_flags} {}
} // namespace OpenGL
diff --git a/src/video_core/renderer_opengl/gl_state_tracker.h b/src/video_core/renderer_opengl/gl_state_tracker.h
index 97d32768b..19bcf3f35 100644
--- a/src/video_core/renderer_opengl/gl_state_tracker.h
+++ b/src/video_core/renderer_opengl/gl_state_tracker.h
@@ -223,6 +223,7 @@ public:
private:
Tegra::Engines::Maxwell3D::DirtyState::Flags* flags;
+ Tegra::Engines::Maxwell3D::DirtyState::Flags default_flags{};
GLuint framebuffer = 0;
GLuint index_buffer = 0;
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.cpp b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
index 5a11d3267..f234e1a31 100644
--- a/src/video_core/renderer_vulkan/vk_state_tracker.cpp
+++ b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
@@ -206,6 +206,7 @@ void StateTracker::InvalidateState() {
flags->set();
}
-StateTracker::StateTracker() : flags{}, invalidation_flags{MakeInvalidationFlags()} {}
+StateTracker::StateTracker()
+ : flags{&default_flags}, default_flags{}, invalidation_flags{MakeInvalidationFlags()} {}
} // namespace Vulkan
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.h b/src/video_core/renderer_vulkan/vk_state_tracker.h
index c107d9c24..2296dea60 100644
--- a/src/video_core/renderer_vulkan/vk_state_tracker.h
+++ b/src/video_core/renderer_vulkan/vk_state_tracker.h
@@ -161,6 +161,7 @@ private:
}
Tegra::Engines::Maxwell3D::DirtyState::Flags* flags;
+ Tegra::Engines::Maxwell3D::DirtyState::Flags default_flags;
Tegra::Engines::Maxwell3D::DirtyState::Flags invalidation_flags;
Maxwell::PrimitiveTopology current_topology = INVALID_TOPOLOGY;
};